#include<iostream>
using namespace std;

const int N = 1e5;
int q[N]; 


int quick_sort_k(int q[],int l,int r,int k){
	if(l >= r) return q[l];
	
	int x = q[l+r>>1],i = l-1,j = r+1;
	while(i < j){
		do i++; while(x > q[i]);
		do j--; while(x < q[j]);
		if(i < j) swap(q[i],q[j]);
	}
	if(j-l+1>=k) return quick_sort_k(q,l,j,k);
    else return quick_sort_k(q,j+1,r,k-(j-l+1));
	
}

int main(){
	int n,k;
	cin>>n>>k;
	for(int i = 0;i <n;i++) cin>>q[i];
	cout<<quick_sort_k(q,0,n-1,k);
	return 0;
}
